#include "widget.h"
#include "ui_widget.h"
#include<QIcon>
#include<QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    QIcon icon(":/haizeiwang.jpg");
    ui->setupUi(this);
    this->setWindowTitle("这是一个窗口");
    this->setWindowIcon(icon);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_add_clicked()
{
    float opacity=this->windowOpacity();
    if(opacity>=1.0){
        return ;
    }
    qDebug()<<opacity;
    opacity+=0.1;
    this->setWindowOpacity(opacity);
}

void Widget::on_pushButton_sub_clicked()
{
    float opacity=this->windowOpacity();
    if(opacity<=0.0){
        return ;
    }
    qDebug()<<opacity;
    opacity-=0.1;
    this->setWindowOpacity(opacity);
}
